using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Web.Core.Objects;

public partial class AdminCP_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.ImageButtonLogin.ImageUrl = "~/Images/button_sign_in.gif";
    }

    protected void ImageButtonLogin_Click(object sender, ImageClickEventArgs e)
    {
        Member mem = Members.GetMemberByLogin(this.txtEmail.Text.Trim(), this.txtPassword.Text);

        if (mem != null)
        {
            mem.LastLogin = DateTime.Now.Month + "/" + DateTime.Now.Day + "/" + DateTime.Now.Year;
            Members.UpdateMember(mem);
            Session["Membership"] = mem;            
            this.MsgClient.InnerHtml = "<script language='javascript'>window.location = \"Default.aspx\";</script>";
        }
        else
            this.MsgClient.InnerHtml = "<script language='javascript'>window.location = \"Login.aspx\";</script>";
    }
}
